#ifndef Vector2H
#define Vector2H

#include <iostream>


// Vector2
class Vector2
{
public:

	static const unsigned int ELEMENTCOUNT = 2;
	static const float        EQUALLIMIT;
	static const Vector2      ZERO;
	static const Vector2      UNIT_X;
	static const Vector2      UNIT_Y;

	union
	{
		float mElement[ELEMENTCOUNT];
		struct
		{
			float mX;
			float mY;
		};
	};

	 Vector2();
 	 Vector2( const Vector2& v );
	 Vector2( float x, float y );
	 Vector2( const float data[ELEMENTCOUNT] );
	 Vector2( const int   data[ELEMENTCOUNT] );
	~Vector2();

	float          operator [] ( unsigned int i ) const;
	float&         operator [] ( unsigned int i );
	const Vector2& operator +  () const;
	Vector2        operator -  () const;
	Vector2        operator +  ( const Vector2& v ) const;
	Vector2        operator -  ( const Vector2& v ) const;
	Vector2        operator *  ( float s ) const;
	Vector2        operator /  ( float s ) const;
	Vector2&       operator =  ( const Vector2& v );
	Vector2&       operator += ( const Vector2& v );
	Vector2&       operator -= ( const Vector2& v );
	Vector2&       operator *= ( float s );
	Vector2&       operator /= ( float s );
	bool           operator == ( const Vector2& v ) const;
	bool           operator != ( const Vector2& v ) const;

	float    Dot( const Vector2& v ) const;
	float    GetSquaredLength() const;
	float    GetLength() const;
	Vector2& Normalize();

};

Vector2 operator * ( float s, const Vector2& v );

std::ostream& operator << ( std::ostream& o, const Vector2& v );


#endif
